﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Electronic_work_order.Interfacess.OA_Demand;
using Electronic_work_order.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Electronic_work_order.Controllers
{
    //[Route("api/[controller]")]
    [ApiController]
    public class OA_DemandController : ControllerBase
    {
        private readonly IDemand _demand;

        public OA_DemandController(IDemand demand)
        {
            _demand = demand;
        }
        //添加数据
        [HttpPost]
        [Route("[controller]/AddDemand")]
        public int AddDemand(Demand de)
        {
            int count = _demand.AddDemand(de);
            if (count>0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
    }
}
